/*
 * Funny Language - a free style programming language.
 * Copyright (C) 2015 by fanguangping (fanguangping@163.com)
 * dfa.h
 */

#ifndef FUNNY_DFA_H
#define FUNNY_DFA_H

#include "../ds/datastructure.h"
#include "statement.h"
#include "mapping.h"
#include "state.h"

typedef struct _TransitNode {
    State *starter;
    Statement *input;
    State *next;
} TransitNode;

TransitNode *alloc_transit_node();

void set_repeat_transition(State *starter, State *repeatState, Statement *repeat);
State *to_dfa(Statement *s);
State *transit(State *starter, State *start, Statement *input, Queue *repQueue);
HashTable getStateTable();
TransitNode *get_transit_node_from_table(State *starter, State *start, Statement *input);
State *test_match(Mapping *mapping, Statement *source, Queue *replaceQueue);

#endif //FUNNY_DFA_H
